<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>个人中心新闻发布</title>
		<!-- import CSS -->
		<link rel="stylesheet" href="/static/element-ui/lib/theme-chalk/element.css">
		<!-- import Vue before Element -->
		<script src="/static/js/vue.js"></script>
		<!-- import JavaScript -->
		<script src="/static/element-ui/lib/index.js"></script>
		<script type="text/javascript" src="/static/layui/jquery.min.js"></script>
		<style>
			.divCss {
				width: 100%;
				height:100%;
				/* 边框属性 */
				border: 1px solid #cccccc;
				border-radius: 2px;
				/* 内边距 */
				padding: 10px;
				margin: 0 auto;
				/* 投影 */
				box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
			}
		</style>
	</head>
	<body>
		<div id="div_news">
			<div class="divCss">
				<template>
					<!-- border启用边框  heighit固定表头 fixed：固定列-->
					<el-table :data="tableData" border height="600px" style="width: 100%">
						<el-table-column prop="newstitle" label="新闻标题" width="150">
						</el-table-column>
						<el-table-column prop="newscontent" label="新闻内容" width="500">
						</el-table-column>
						<el-table-column prop="createtime" label="发布时间" width="120">
						</el-table-column>
						<el-table-column prop="username" label="新闻发布者" width="100">
						</el-table-column>
						<el-table-column prop="image" label="新闻图片" width="390">
						</el-table-column>
						
						<el-table-column fixed="right" label="新闻状态" width="100">
							<template slot-scope="scope">
								<el-button @click="handleClick(scope.row)" type="text" size="small">正常</el-button>
								<el-button type="text" size="small">删除</el-button>
							</template>
						</el-table-column>
					</el-table>
				</template>
			</div>

		</div>

		<script>
			var app = new Vue({
				el: '#div_news',
				methods: {
					handleClick(row) {
						console.log(row);
					}
				},
				data: {
					tableData: []

				},mounted: function() {		           
		            this.getnewstable();
		        },
		        methods: {
		            //公告详情跳转
		            getnewstable:function(){
		            	var that = this;
		            	$.ajax({
		                    url: '/news/all',				                   
		                    contentType: "application/json;charset=UTF-8",
		                    dataType: 'json',
		                    success: function(msg) {
		                        that.tableData=msg.data;	
		                        console.log(msg.data);
		                    },error:function () {
		                        console.log("err");
		                    }
		                });
		            }
		        }

			})
		</script>
	</body>
</html>
